import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:'/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children:[
      {
        path: '/echarts',
        name: 'echarts',
        component: () => import('../views/HomeChildren/EchartsView.vue'),
        meta:{
          title:'数据展示'
        }
      },
      {
        path: '/permissionlist',
        name: 'permissionlist',
        component: () => import('../views/HomeChildren/PermissionList.vue'),
        meta:{
          title:'权限列表'
        }
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/HomeChildren/UserOne.vue'),
        meta:{
          title:'住户信息'
        },
      },
      {
        path: '/userlist',
        name: 'userlist',
        component: () => import('../views/HomeChildren/UserList.vue'),
        meta:{
          classifyTitle: "用户信息",
          title:'住户列表'
        }
      },
      {
        path: '/userupdate',
        name: 'userupdate',
        component: () => import('../views/HomeChildren/UserUpdate.vue'),
        meta:{
          classifyTitle: "用户信息",
          title:'住户信息修改'
        }
      },
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
